package com.oct.ywsc.core;

import lombok.Getter;

public enum OptTypeEnum {

    INSERT("I","insert"),
    UPDATE("U","update"),
    DELETE("D","delete");

    @Getter
    private String optType;

    @Getter
    private String optDesc;

    OptTypeEnum(String optType, String optDesc) {
        this.optType = optType;
        this.optDesc = optDesc;
    }

    public static OptTypeEnum findOptTypeEnum(String optType) {

        for (OptTypeEnum optTypeEnum : OptTypeEnum.values()) {
            if (optTypeEnum.getOptType().equals(optType) || optTypeEnum.getOptType().equals(optType.toUpperCase())) {
                return optTypeEnum;
            }
        }
        return null;
    }

}
